package thread.communication;
import static java.lang.System.out;

/**
 * 
 * @author Shahid
 */
public class GetValue implements Runnable {
	static int[] array = new int[30];

	public void run() {

		// Fill the array with sleep of 1 millisecond
		try {
			for (int j = 0; j < 30; j++) {
				array[j] = j;
				Thread.sleep(1);
			}
		} catch (InterruptedException e) {
			out.println(e.toString());
		}
	}

	public static void main(String[] args) throws InterruptedException {
		
		new Thread(new GetValue()).start();

		print();
		Thread.sleep(10);
		print();
		Thread.sleep(10);
		print();
		Thread.sleep(10);
		print();

	}

	static void print() {
		for (int i : array) {
			out.print(i + ",");
		}
		out.print("\n");
	}
}

// Output
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,1,2,3,4,5,6,7,8,9,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,0,0,0,0,0,0,0,0,0,
// 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
